\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler}{
\section{db::databaseHandler::databaseHandler Class Reference}
\label{classdb_1_1databaseHandler_1_1databaseHandler}\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
def \hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_3d063c499af1c5d8072cb421644eccb1}{open\_\-connection}
\begin{CompactList}\small\item\em open\_\-connection is used to initiate the database connection. \item\end{CompactList}\item 
def \hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_75ecfb3aad8599c96962f612bd772053}{close\_\-connection}
\begin{CompactList}\small\item\em close\_\-connection is used to close the database connection. \item\end{CompactList}\item 
def \hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_ff7bb9a5a5b72d37562991fedd6d44d6}{get\_\-media\_\-types}
\begin{CompactList}\small\item\em get\_\-media\_\-types gets all media types from database \item\end{CompactList}\item 
def \hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_067c182dff53692b4fec5df114a84449}{do\_\-search}
\begin{CompactList}\small\item\em do\_\-search searches the database for the given criteria. \item\end{CompactList}\item 
def \hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_1ea9239394df46c86b5572e971330f7b}{search\_\-media\_\-types}
\begin{CompactList}\small\item\em search\_\-media\_\-types searches for media with the given media type id. \item\end{CompactList}\item 
def \hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_4a72823cbe952f5a676452876f635d7f}{add\_\-to\_\-db}
\begin{CompactList}\small\item\em add\_\-to\_\-db adds the given media object to the database. \item\end{CompactList}\item 
def \hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_48c01f4c80a89faae1a90f1000650620}{delete\_\-media}
\begin{CompactList}\small\item\em detele\_\-media removes the media corresponding to the given media id. \item\end{CompactList}\item 
def \hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_b35f6bcb76d9359f8833d95269212efe}{execute\_\-query}
\begin{CompactList}\small\item\em execute\_\-query executes the query given as argument. \item\end{CompactList}\item 
def \hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_07822f49d9c4451af9716617c49b7475}{get\_\-movie\_\-book\_\-info}
\begin{CompactList}\small\item\em get\_\-movie\_\-book\_\-information fetches all information if the media is a movie or a book \item\end{CompactList}\item 
def \hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_be2d0ec8042dd1bca10b82e1ff515ed6}{get\_\-music\_\-info}
\begin{CompactList}\small\item\em get\_\-movie\_\-book\_\-information fetches all information if the media is a music \item\end{CompactList}\item 
def \hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_5ade246ea5cf5b4c85feec3a220721a4}{create\_\-database}
\begin{CompactList}\small\item\em create\_\-database initiates a databasefile if there is none \item\end{CompactList}\item 
def \hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_1500317444f7346b013b82495892c9d0}{\_\-\_\-init\_\-\_\-}
\begin{CompactList}\small\item\em \_\-\_\-init\_\-\_\- is the construct for the database handler \item\end{CompactList}\end{CompactItemize}
\subsection*{Public Attributes}
\begin{CompactItemize}
\item 
\hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_d26435735824c66468e479dd9dcdbe40}{connection}
\item 
\hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_056964ca72ec919929ade66be533c51e}{cursor}
\item 
\hyperlink{classdb_1_1databaseHandler_1_1databaseHandler_a064cd1b772b457d3006650577e07611}{db\_\-name}
\end{CompactItemize}


\subsection{Member Function Documentation}
\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_3d063c499af1c5d8072cb421644eccb1}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!open\_\-connection@{open\_\-connection}}
\index{open\_\-connection@{open\_\-connection}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}def db::databaseHandler::databaseHandler::open\_\-connection ( {\em self})}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_3d063c499af1c5d8072cb421644eccb1}


open\_\-connection is used to initiate the database connection. 

opens a connection to the sqlite database for \hyperlink{namespaceadelide}{adelide}, used before each query. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em self}]\end{description}
\end{Desc}
\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_75ecfb3aad8599c96962f612bd772053}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!close\_\-connection@{close\_\-connection}}
\index{close\_\-connection@{close\_\-connection}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}def db::databaseHandler::databaseHandler::close\_\-connection ( {\em self})}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_75ecfb3aad8599c96962f612bd772053}


close\_\-connection is used to close the database connection. 

closes the connection to the sqlite database for \hyperlink{namespaceadelide}{adelide}, used after each query. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em self}]\end{description}
\end{Desc}
\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_ff7bb9a5a5b72d37562991fedd6d44d6}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!get\_\-media\_\-types@{get\_\-media\_\-types}}
\index{get\_\-media\_\-types@{get\_\-media\_\-types}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}def db::databaseHandler::databaseHandler::get\_\-media\_\-types ( {\em self})}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_ff7bb9a5a5b72d37562991fedd6d44d6}


get\_\-media\_\-types gets all media types from database 

\begin{Desc}
\item[Returns:]Returns a list of the database tables and rows. These will need to be proccessed. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em self}]\end{description}
\end{Desc}
\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_067c182dff53692b4fec5df114a84449}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!do\_\-search@{do\_\-search}}
\index{do\_\-search@{do\_\-search}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}def db::databaseHandler::databaseHandler::do\_\-search ( {\em self}, \/   {\em title})}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_067c182dff53692b4fec5df114a84449}


do\_\-search searches the database for the given criteria. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em self}]\item[{\em title}]string \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]returns a list of media objects found. If None is found an empty list is returned (Erlang warning on this one.) \end{Desc}
\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_1ea9239394df46c86b5572e971330f7b}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!search\_\-media\_\-types@{search\_\-media\_\-types}}
\index{search\_\-media\_\-types@{search\_\-media\_\-types}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}def db::databaseHandler::databaseHandler::search\_\-media\_\-types ( {\em self}, \/   {\em type\_\-id})}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_1ea9239394df46c86b5572e971330f7b}


search\_\-media\_\-types searches for media with the given media type id. 

Used for creating a list of i.e Movies or Books. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em self}]\item[{\em type\_\-id}]the type id of the given format (1 = Book, 2 = Movie, 3 = Music, 4 = Games) \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]returns a list of media corresponding to the type\_\-id given in the argument. If no media is found an empty list is returned. (Erlang warning on this one too.) \end{Desc}
\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_4a72823cbe952f5a676452876f635d7f}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!add\_\-to\_\-db@{add\_\-to\_\-db}}
\index{add\_\-to\_\-db@{add\_\-to\_\-db}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}def db::databaseHandler::databaseHandler::add\_\-to\_\-db ( {\em self}, \/   {\em media})}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_4a72823cbe952f5a676452876f635d7f}


add\_\-to\_\-db adds the given media object to the database. 

Adds media object without createing any types of relations to humans or groups. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em self}]\item[{\em media}]a media object. \end{description}
\end{Desc}
\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_48c01f4c80a89faae1a90f1000650620}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!delete\_\-media@{delete\_\-media}}
\index{delete\_\-media@{delete\_\-media}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}def db::databaseHandler::databaseHandler::delete\_\-media ( {\em self}, \/   {\em media\_\-id})}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_48c01f4c80a89faae1a90f1000650620}


detele\_\-media removes the media corresponding to the given media id. 

Deletes the media from the database, does not remove relations in other tables. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em self}]\item[{\em media\_\-id}]a media id. \end{description}
\end{Desc}
\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_b35f6bcb76d9359f8833d95269212efe}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!execute\_\-query@{execute\_\-query}}
\index{execute\_\-query@{execute\_\-query}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}def db::databaseHandler::databaseHandler::execute\_\-query ( {\em self}, \/   {\em query})}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_b35f6bcb76d9359f8833d95269212efe}


execute\_\-query executes the query given as argument. 

If this query returns a set of media media will be created. This is only for use in testing. DO NOT USE THIS METHOD FOR ANYTHING OTHER THAN TESTING! It will fail if used for anything else than adding media or retrieving media. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em self}]\item[{\em query}]to execute \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]an array with the data fetched from the supplied query \end{Desc}
\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_07822f49d9c4451af9716617c49b7475}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!get\_\-movie\_\-book\_\-info@{get\_\-movie\_\-book\_\-info}}
\index{get\_\-movie\_\-book\_\-info@{get\_\-movie\_\-book\_\-info}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}def db::databaseHandler::databaseHandler::get\_\-movie\_\-book\_\-info ( {\em self}, \/   {\em media\_\-id})}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_07822f49d9c4451af9716617c49b7475}


get\_\-movie\_\-book\_\-information fetches all information if the media is a movie or a book 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em self}]\item[{\em media}]id to fetch \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]all data related to the media id \end{Desc}
\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_be2d0ec8042dd1bca10b82e1ff515ed6}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!get\_\-music\_\-info@{get\_\-music\_\-info}}
\index{get\_\-music\_\-info@{get\_\-music\_\-info}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}def db::databaseHandler::databaseHandler::get\_\-music\_\-info ( {\em self}, \/   {\em media\_\-id})}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_be2d0ec8042dd1bca10b82e1ff515ed6}


get\_\-movie\_\-book\_\-information fetches all information if the media is a music 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em self}]\item[{\em media}]id to fetch \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]all data related to the media id \end{Desc}
\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_5ade246ea5cf5b4c85feec3a220721a4}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!create\_\-database@{create\_\-database}}
\index{create\_\-database@{create\_\-database}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}def db::databaseHandler::databaseHandler::create\_\-database ( {\em self})}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_5ade246ea5cf5b4c85feec3a220721a4}


create\_\-database initiates a databasefile if there is none 

create\_\-database is used for creating an initial database for the user. If a database is present upon start up this method will never be executed. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em self}]\end{description}
\end{Desc}
\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_1500317444f7346b013b82495892c9d0}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!\_\-\_\-init\_\-\_\-@{\_\-\_\-init\_\-\_\-}}
\index{\_\-\_\-init\_\-\_\-@{\_\-\_\-init\_\-\_\-}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}def db::databaseHandler::databaseHandler::\_\-\_\-init\_\-\_\- ( {\em self})}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_1500317444f7346b013b82495892c9d0}


\_\-\_\-init\_\-\_\- is the construct for the database handler 

Sets \hyperlink{namespacedb}{db} path depending on from where the file is run, creates database file if needed. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em self}]\end{description}
\end{Desc}


\subsection{Member Data Documentation}
\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_d26435735824c66468e479dd9dcdbe40}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!connection@{connection}}
\index{connection@{connection}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf db::databaseHandler::databaseHandler::connection}}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_d26435735824c66468e479dd9dcdbe40}


\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_056964ca72ec919929ade66be533c51e}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!cursor@{cursor}}
\index{cursor@{cursor}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf db::databaseHandler::databaseHandler::cursor}}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_056964ca72ec919929ade66be533c51e}


\hypertarget{classdb_1_1databaseHandler_1_1databaseHandler_a064cd1b772b457d3006650577e07611}{
\index{db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}!db\_\-name@{db\_\-name}}
\index{db\_\-name@{db\_\-name}!db::databaseHandler::databaseHandler@{db::databaseHandler::databaseHandler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf db::databaseHandler::databaseHandler::db\_\-name}}}
\label{classdb_1_1databaseHandler_1_1databaseHandler_a064cd1b772b457d3006650577e07611}




The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
/home/mett/src/adelide/src/db/\hyperlink{databaseHandler_8py}{databaseHandler.py}\end{CompactItemize}
